package Gameplay.Enemy;

import ADTs.PointADT;
import Gameplay.Level;
import Gameplay.Player;
import Gameplay.Projectile.Projectile;
import Project.Main;

public class AI6 extends AI{
	private long lastMove;
	private long moveCooldown;

	public AI6(){
		super();
		this.lastMove = 0;
		this.moveCooldown = 500;
		this.cooldown = 1000;
		this.lastFired = 0;

	}

	@Override
	public boolean move(Enemy e) {
		return true;
	}

	@Override
	public void attack(Enemy e) {
		Player p = ((Level)Main.getCurrentUI()).getPlayer();
		PointADT shoot_11 = new PointADT(e.getLocation().copy().getX() + 100, e.getLocation().copy().getY() + 200);
		PointADT shoot_10 = new PointADT(e.getLocation().copy().getX() + 100, e.getLocation().copy().getY() + 100);
		PointADT shoot_9 = new PointADT(e.getLocation().copy().getX() + 100, e.getLocation().copy().getY());
		PointADT shoot_8 = new PointADT(e.getLocation().copy().getX() + 100, e.getLocation().copy().getY() + 100);
		PointADT shoot_7 = new PointADT(e.getLocation().copy().getX() + 100, e.getLocation().copy().getY() + 200);
		PointADT de_shoot_11 = PointADT.addPoints(shoot_11, new PointADT(-e.getLocation().getX(),-e.getLocation().getY()));
		PointADT de_shoot_10 = PointADT.addPoints(shoot_10, new PointADT(-e.getLocation().getX(),-e.getLocation().getY()));
		PointADT de_shoot_9 = PointADT.addPoints(shoot_9, new PointADT(-e.getLocation().getX(),-e.getLocation().getY()));
		PointADT de_shoot_8 = PointADT.addPoints(shoot_8, new PointADT(-e.getLocation().getX(),-e.getLocation().getY()));
		PointADT de_shoot_7 = PointADT.addPoints(shoot_7, new PointADT(-e.getLocation().getX(),-e.getLocation().getY()));
//		PointADT verticalShootup = new PointADT(e.getLocation().copy().getX(), e.getLocation().copy().getY() - 100);
//		PointADT verticalShootdown = new PointADT(e.getLocation().copy().getX(), e.getLocation().copy().getY() + 100);
//		PointADT destUp = PointADT.addPoints(verticalShootup, new PointADT(-e.getLocation().getX(),-e.getLocation().getY()));
//		PointADT destDown = PointADT.addPoints(verticalShootdown, new PointADT(-e.getLocation().getX(),-e.getLocation().getY()));
		de_shoot_11.setY(-de_shoot_11.getY());
		de_shoot_10.setY(-de_shoot_10.getY());
		de_shoot_9.setY(-de_shoot_9.getY());
		de_shoot_8.setY(-de_shoot_8.getY());
		de_shoot_7.setY(-de_shoot_7.getY());
		if(lastFired + cooldown < System.currentTimeMillis()) {
			((Level) Main.getCurrentUI()).addToState(new Projectile(de_shoot_11, e.getLocation().copy(), false));
			((Level) Main.getCurrentUI()).addToState(new Projectile(de_shoot_10, e.getLocation().copy(), false));
			((Level) Main.getCurrentUI()).addToState(new Projectile(de_shoot_9, e.getLocation().copy(), false));
			((Level) Main.getCurrentUI()).addToState(new Projectile(de_shoot_8, e.getLocation().copy(), false));
			((Level) Main.getCurrentUI()).addToState(new Projectile(de_shoot_7, e.getLocation().copy(), false));
			lastFired = System.currentTimeMillis();
		}
	}
}
